/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseWorkFlowEntity.cs
*        创建系统时间:       2012/11/2 19:07:03
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;

    [Serializable]
    public class BaseWorkFlowEntity
    {
        public string CategoryID;
        public string Code;
        public string CreateDate;
        public string CreateUserID;
        public string Description;
        public bool Enabled;
        public string FullName;
        public string ID;
        public string ModifyDate;
        public string ModifyUserID;
        public string OrganizeID;
        public string SortCode;

        public BaseWorkFlowEntity()
        {
            this.ID = string.Empty;
            this.OrganizeID = string.Empty;
            this.CategoryID = string.Empty;
            this.Code = string.Empty;
            this.FullName = string.Empty;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
        }

        public BaseWorkFlowEntity(DataRow dataRow)
        {
            this.ID = string.Empty;
            this.OrganizeID = string.Empty;
            this.CategoryID = string.Empty;
            this.Code = string.Empty;
            this.FullName = string.Empty;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public BaseWorkFlowEntity(DataTable dataTable)
        {
            this.ID = string.Empty;
            this.OrganizeID = string.Empty;
            this.CategoryID = string.Empty;
            this.Code = string.Empty;
            this.FullName = string.Empty;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
            this.GetFrom(dataTable);
        }

        public void ClearProperty()
        {
            this.ID = string.Empty;
            this.OrganizeID = string.Empty;
            this.CategoryID = string.Empty;
            this.Code = string.Empty;
            this.FullName = string.Empty;
            this.Enabled = false;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
        }

        public BaseWorkFlowEntity GetFrom(DataRow dataRow)
        {
            this.ID = dataRow[BaseWorkFlowTable.FieldID].ToString();
            this.OrganizeID = dataRow[BaseWorkFlowTable.FieldOrganizeID].ToString();
            this.CategoryID = dataRow[BaseWorkFlowTable.FieldCategoryID].ToString();
            this.Code = dataRow[BaseWorkFlowTable.FieldCode].ToString();
            this.FullName = dataRow[BaseWorkFlowTable.FieldFullName].ToString();
            this.Enabled = dataRow[BaseWorkFlowTable.FieldEnabled].ToString().Equals("1");
            this.SortCode = dataRow[BaseWorkFlowTable.FieldSortCode].ToString();
            this.Description = dataRow[BaseWorkFlowTable.FieldDescription].ToString();
            this.CreateUserID = dataRow[BaseWorkFlowTable.FieldCreateUserID].ToString();
            this.CreateDate = dataRow[BaseWorkFlowTable.FieldCreateDate].ToString();
            this.ModifyUserID = dataRow[BaseWorkFlowTable.FieldModifyUserID].ToString();
            this.ModifyDate = dataRow[BaseWorkFlowTable.FieldModifyDate].ToString();
            return this;
        }

        public BaseWorkFlowEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }
    }
}